package controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.RoomModel;
import service.RoomService;
import service.impl.RoomServiceImpl;

/**
 * Servlet implementation class RoomMsgServlet
 */
@WebServlet("/servlet/RoomMsgServlet")
public class RoomMsgServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private RoomService service=new RoomServiceImpl();

       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RoomMsgServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		RoomModel roomModel=new RoomModel();
		try {
			List<RoomModel> roomlist=service.allList();
			request.setAttribute("roomlist",roomlist);
			request.getRequestDispatcher("../master.jsp").forward(request, response);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
